using System;
using Llibs.Timer;

namespace Client.Hotfix
{
    [UGFM(UGFMWeight.TimerService)]
    public class TimerService : IAwake, IUpdate, IDestroy
    {
        private TickTimer tickTimer;
        public void Awake()
        {
            tickTimer = new TickTimer(0, false);
            this.Log("TimerService is running");
        }

        public void Update()
        {
            tickTimer?.UpdateTask();
        }
        public void Destroy()
        {
            tickTimer?.Reset();
            tickTimer = null;
        }
        public int AddTask(uint delay, Action<int> taskCB, Action<int> cancelCB, int count = 1)
        {
            return tickTimer.AddTask(delay, taskCB, cancelCB, count);
        }

        public void DeleteTask(int taskId)
        {
            tickTimer.DeleteTask(taskId);
        }

    }


}
